<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .box {
        border: solid;
        padding: 10px;
      }
    </style>
  </head>
  <body>
    <div id="app"></div>

    <template id="t1">
      <div>
        <input type="checkbox" value="css" v-model="hobbys" /> CSS
        <input type="checkbox" value="js" v-model="hobbys" /> JS
        <input type="checkbox" value="html" v-model="hobbys" /> HTML
        <hr />
        {{hobbys}}
        <button @click="hobbys.push('css')">set</button>
      </div>
    </template>
    <script src="./vue.js"></script>
    <script>
      /*
      checkbox
       1. 根据绑定变量分组，变量名相同的分为一组
       2. 绑定数据变量的类型必须是个数组
       3. 默认值的设置：数组元素对应标签的value值
      */
      const vm = new Vue({
        el: "#app",
        template: "#t1",
        data: {
          hobbys: ["js", "html"],
        },
      });
    </script>
  </body>
</html>
